home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Programming / fpc / amigaunits / rexx.pas < prev    next >
Pascal/Delphi Source File  |  1998-09-22  |  21KB  |  601 lines

  1. {
  2.     This file is part of the Free Pascal run time library.
  3.  
  4.     A file in Amiga system run time library.
  5.     Copyright (c) 1998 by Nils Sjoholm
  6.     member of the Amiga RTL development team.
  7.  
  8.     See the file COPYING.FPC, included in this distribution,
  9.     for details about the copyright.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15.  **********************************************************************}
  16.  
  17.  
  18. UNIT rexx;
  19.  
  20. INTERFACE
  21. USES exec;
  22.  
  23.  
  24. { === rexx/storage.h ==================================================
  25.  *
  26.  * Copyright (c) 1986, 1987 by William S. Hawes (All Rights Reserved)
  27.  *
  28.  * =====================================================================
  29.  * Header file to define ARexx data structures.
  30. }
  31.  
  32.  
  33. { The NexxStr structure is used to maintain the internal strings in REXX.
  34.  * It includes the buffer area for the string and associated attributes.
  35.  * This is actually a variable-length structure; it is allocated for a
  36.  * specific length string, and the length is never modified thereafter
  37.  * (since it's used for recycling).
  38.  }
  39.  
  40. Type
  41.  
  42.     pNexxStr = ^tNexxStr;
  43.     tNexxStr = record
  44.     ns_Ivalue   : Longint;  { integer value                 }
  45.     ns_Length   : Word;     { length in bytes (excl null)   }
  46.     ns_Flags    : Byte;     { attribute flags               }
  47.     ns_Hash     : Byte;     { hash code                     }
  48.     ns_Buff     : Array [0..7] of Byte;
  49.                     { buffer area for strings       }
  50.     end;                { size: 16 bytes (minimum)      }
  51.  
  52. Const
  53.  
  54.     NXADDLEN    = 9;            { offset plus null byte         }
  55.  
  56. { String attribute flag bit definitions                                }
  57.  
  58.     NSB_KEEP    = 0;            { permanent string?             }
  59.     NSB_STRING  = 1;            { string form valid?            }
  60.     NSB_NOTNUM  = 2;            { non-numeric?                  }
  61.     NSB_NUMBER  = 3;            { a valid number?               }
  62.     NSB_BINARY  = 4;            { integer value saved?          }
  63.     NSB_FLOAT   = 5;            { floating point format?        }
  64.     NSB_EXT = 6;            { an external string?           }
  65.     NSB_SOURCE  = 7;            { part of the program source?   }
  66.  
  67. { The flag form of the string attributes                               }
  68.  
  69.     NSF_KEEP    = 1;
  70.     NSF_STRING  = 2;
  71.     NSF_NOTNUM  = 4;
  72.     NSF_NUMBER  = 8;
  73.     NSF_BINARY  = 16;
  74.     NSF_FLOAT   = 32;
  75.     NSF_EXT = 64;
  76.     NSF_SOURCE  = 128;
  77.  
  78. { Combinations of flags                                                }
  79.  
  80.     NSF_INTNUM  = NSF_NUMBER + NSF_BINARY + NSF_STRING;
  81.     NSF_DPNUM   = NSF_NUMBER + NSF_FLOAT;
  82.     NSF_ALPHA   = NSF_NOTNUM + NSF_STRING;
  83.     NSF_OWNED   = NSF_SOURCE + NSF_EXT    + NSF_KEEP;
  84.     KEEPSTR = NSF_STRING + NSF_SOURCE + NSF_NOTNUM;
  85.     KEEPNUM = NSF_STRING + NSF_SOURCE + NSF_NUMBER + NSF_BINARY;
  86.  
  87. { The RexxArg structure is identical to the NexxStr structure, but
  88.  * is allocated from system memory rather than from internal storage.
  89.  * This structure is used for passing arguments to external programs.
  90.  * It is usually passed as an "argstring", a pointer to the string buffer.
  91. }
  92.  
  93. Type
  94.  
  95.     pRexxArg = ^tRexxArg;
  96.     tRexxArg = record
  97.     ra_Size     : Longint;  { total allocated length        }
  98.     ra_Length   : Word;     { length of string              }
  99.     ra_Flags    : Byte;     { attribute flags               }
  100.     ra_Hash     : Byte;     { hash code                     }
  101.     ra_Buff     : Array [0..7] of Byte;
  102.                     { buffer area                   }
  103.     end;                { size: 16 bytes (minimum)      }
  104.  
  105. { The RexxMsg structure is used for all communications with REXX
  106.  * programs.  It is an EXEC message with a parameter block appended.
  107. }
  108.  
  109.     pRexxMsg = ^tRexxMsg;
  110.     tRexxMsg = record
  111.     rm_Node     : tMessage;  { EXEC message structure        }
  112.     rm_TaskBlock    : Pointer;  { global structure (private)    }
  113.     rm_LibBase  : Pointer;  { library base (private)        }
  114.     rm_Action   : Longint;  { command (action) code         }
  115.     rm_Result1  : Longint;  { primary result (return code)  }
  116.     rm_Result2  : Longint;  { secondary result              }
  117.     rm_Args     : Array [0..15] of STRPTR;
  118.                     { argument block (ARG0-ARG15)   }
  119.  
  120.     rm_PassPort : pMsgPort;   { forwarding port               }
  121.     rm_CommAddr : STRPTR;   { host address (port name)      }
  122.     rm_FileExt  : STRPTR;   { file extension                }
  123.     rm_Stdin    : Longint;  { input stream (filehandle)     }
  124.     rm_Stdout   : Longint;  { output stream (filehandle)    }
  125.     rm_avail    : Longint;  { future expansion              }
  126.     end;                { size: 128 bytes               }
  127.  
  128. Const
  129.  
  130.     MAXRMARG        = 15;       { maximum arguments             }
  131.  
  132. { Command (action) codes for message packets                           }
  133.  
  134.     RXCOMM      = $01000000;    { a command-level invocation    }
  135.     RXFUNC      = $02000000;    { a function call               }
  136.     RXCLOSE     = $03000000;    { close the REXX server         }
  137.     RXQUERY     = $04000000;    { query for information         }
  138.     RXADDFH     = $07000000;    { add a function host           }
  139.     RXADDLIB        = $08000000;    { add a function library        }
  140.     RXREMLIB        = $09000000;    { remove a function library     }
  141.     RXADDCON        = $0A000000;    { add/update a ClipList string  }
  142.     RXREMCON        = $0B000000;    { remove a ClipList string      }
  143.     RXTCOPN     = $0C000000;    { open the trace console        }
  144.     RXTCCLS     = $0D000000;    { close the trace console       }
  145.  
  146. { Command modifier flag bits                                           }
  147.  
  148.     RXFB_NOIO       = 16;       { suppress I/O inheritance?     }
  149.     RXFB_RESULT     = 17;       { result string expected?       }
  150.     RXFB_STRING     = 18;       { program is a "string file"?   }
  151.     RXFB_TOKEN      = 19;       { tokenize the command line?    }
  152.     RXFB_NONRET     = 20;       { a "no-return" message?        }
  153.  
  154. { The flag form of the command modifiers                               }
  155.  
  156.     RXFF_NOIO       = $00010000;
  157.     RXFF_RESULT     = $00020000;
  158.     RXFF_STRING     = $00040000;
  159.     RXFF_TOKEN      = $00080000;
  160.     RXFF_NONRET     = $00100000;
  161.  
  162.     RXCODEMASK      = $FF000000;
  163.     RXARGMASK       = $0000000F;
  164.  
  165. { The RexxRsrc structure is used to manage global resources.  Each node 
  166.  * has a name string created as a RexxArg structure, and the total size
  167.  * of the node is saved in the "rr_Size" field.  The REXX systems library
  168.  * provides functions to allocate and release resource nodes.  If special
  169.  * deletion operations are required, an offset and base can be provided in
  170.  * "rr_Func" and "rr_Base", respectively.  This "autodelete" function will
  171.  * be called with the base in register A6 and the node in A0.
  172.  }
  173.  
  174. Type
  175.  
  176.     pRexxRsrc = ^tRexxRsrc;
  177.     tRexxRsrc = record
  178.     rr_Node     : tNode;
  179.     rr_Func     : Integer;    { "auto-delete" offset          }
  180.     rr_Base     : Pointer;  { "auto-delete" base            }
  181.     rr_Size     : Longint;  { total size of node            }
  182.     rr_Arg1     : Longint;  { available ...                 }
  183.     rr_Arg2     : Longint;  { available ...                 }
  184.     end;                { size: 32 bytes                }
  185.  
  186. Const
  187.  
  188. { Resource node types                                                  }
  189.  
  190.     RRT_ANY     = 0;        { any node type ...             }
  191.     RRT_LIB     = 1;        { a function library            }
  192.     RRT_PORT        = 2;        { a public port                 }
  193.     RRT_FILE        = 3;        { a file IoBuff                 }
  194.     RRT_HOST        = 4;        { a function host               }
  195.     RRT_CLIP        = 5;        { a Clip List node              }
  196.  
  197. { The RexxTask structure holds the fields used by REXX to communicate with
  198.  * external processes, including the client task.  It includes the global
  199.  * data structure (and the base environment).  The structure is passed to
  200.  * the newly-created task in its "wake-up" message.
  201.  }
  202.  
  203.     GLOBALSZ        = 200;      { total size of GlobalData      }
  204.  
  205. Type
  206.  
  207.     pRexxTask = ^tRexxTask;
  208.     tRexxTask = record
  209.     rt_Global   : Array [0..GLOBALSZ-1] of Byte;
  210.                     { global data structure         }
  211.     rt_MsgPort  : tMsgPort;  { global message port           }
  212.     rt_Flags    : Byte;     { task flag bits                }
  213.     rt_SigBit   : Shortint;     { signal bit                    }
  214.  
  215.     rt_ClientID : Pointer;  { the client's task ID          }
  216.     rt_MsgPkt   : Pointer;  { the packet being processed    }
  217.     rt_TaskID   : Pointer;  { our task ID                   }
  218.     rt_RexxPort : Pointer;  { the REXX public port          }
  219.  
  220.     rt_ErrTrap  : Pointer;  { Error trap address            }
  221.     rt_StackPtr : Pointer;  { stack pointer for traps       }
  222.  
  223.     rt_Header1  : tList;     { Environment list              }
  224.     rt_Header2  : tList;     { Memory freelist               }
  225.     rt_Header3  : tList;     { Memory allocation list        }
  226.     rt_Header4  : tList;     { Files list                    }
  227.     rt_Header5  : tList;     { Message Ports List            }
  228.     end;
  229.  
  230. Const
  231.  
  232. { Definitions for RexxTask flag bits                                   }
  233.  
  234.     RTFB_TRACE      = 0;        { external trace flag           }
  235.     RTFB_HALT       = 1;        { external halt flag            }
  236.     RTFB_SUSP       = 2;        { suspend task?                 }
  237.     RTFB_TCUSE      = 3;        { trace console in use?         }
  238.     RTFB_WAIT       = 6;        { waiting for reply?            }
  239.     RTFB_CLOSE      = 7;        { task completed?               }
  240.  
  241. { Definitions for memory allocation constants                          }
  242.  
  243.     MEMQUANT        = 16;       { quantum of memory space       }
  244.     MEMMASK     = $FFFFFFF0;    { mask for rounding the size    }
  245.  
  246.     MEMQUICK        = 1;        { EXEC flags: MEMF_PUBLIC       }
  247.     MEMCLEAR        = $00010000;    { EXEC flags: MEMF_CLEAR        }
  248.  
  249. { The SrcNode is a temporary structure used to hold values destined for
  250.  * a segment array.  It is also used to maintain the memory freelist.
  251. }
  252.  
  253. Type
  254.  
  255.     pSrcNode = ^tSrcNode;
  256.     tSrcNode = record
  257.     sn_Succ     : pSrcNode; { next node                     }
  258.     sn_Pred     : pSrcNode; { previous node                 }
  259.     sn_Ptr      : Pointer;  { pointer value                 }
  260.     sn_Size     : Longint;  { size of object                }
  261.     end;                { size: 16 bytes                }
  262.  
  263. { === rexx/rexxio.h ====================================================
  264.  *
  265.  * Copyright (c) 1986, 1987 by William S. Hawes.  All Rights Reserved.
  266.  *
  267.  * ======================================================================
  268.  * Header file for ARexx Input/Output related structures
  269. }
  270.  
  271. Const
  272.  
  273.     RXBUFFSZ    = 204;          { buffer length                 }
  274.  
  275. {
  276.  * The IoBuff is a resource node used to maintain the File List.  Nodes
  277.  * are allocated and linked into the list whenever a file is opened.
  278. }
  279.  
  280. Type
  281.  
  282.     pIoBuff = ^tIoBuff;
  283.     tIoBuff = record
  284.     iobNode     : tRexxRsrc; { structure for files/strings   }
  285.     iobRpt      : Pointer;  { read/write pointer            }
  286.     iobRct      : Longint;  { character count               }
  287.     iobDFH      : Longint;  { DOS filehandle                }
  288.     iobLock     : Longint;  { DOS lock                      }
  289.     iobBct      : Longint;  { buffer length                 }
  290.     iobArea     : Array [0..RXBUFFSZ-1] of Byte;
  291.                     { buffer area                   }
  292.     end;                { size: 256 bytes               }
  293.  
  294. Const
  295.  
  296. { Access mode definitions                                              }
  297.  
  298.     RXIO_EXIST      = -1;       { an external filehandle        }
  299.     RXIO_STRF       = 0;        { a "string file"               }
  300.     RXIO_READ       = 1;        { read-only access              }
  301.     RXIO_WRITE      = 2;        { write mode                    }
  302.     RXIO_APPEND     = 3;        { append mode (existing file)   }
  303.  
  304. {
  305.  * Offset anchors for SeekF()
  306. }
  307.  
  308.     RXIO_BEGIN      = -1;       { relative to start             }
  309.     RXIO_CURR       = 0;        { relative to current position  }
  310.     RXIO_END        = 1;        { relative to end               }
  311.  
  312. {
  313.  * A message port structure, maintained as a resource node.  The ReplyList
  314.  * holds packets that have been received but haven't been replied.
  315. }
  316.  
  317. Type
  318.  
  319.     pRexxMsgPort = ^tRexxMsgPort;
  320.     tRexxMsgPort = record
  321.     rmp_Node    : tRexxRsrc; { linkage node                  }
  322.     rmp_Port    : tMsgPort;  { the message port              }
  323.     rmp_ReplyList   : tList;     { messages awaiting reply       }
  324.     end;
  325.  
  326. Const
  327.  
  328. {
  329.  * DOS Device types
  330. }
  331.  
  332.     DT_DEV  = 0;            { a device                      }
  333.     DT_DIR  = 1;            { an ASSIGNed directory         }
  334.     DT_VOL  = 2;            { a volume                      }
  335.  
  336. {
  337.  * Private DOS packet types
  338. }
  339.  
  340.     ACTION_STACK    = 2002;     { stack a line                  }
  341.     ACTION_QUEUE    = 2003;     { queue a line                  }
  342.  
  343. { === rexx/rxslib.h ===================================================
  344.  *
  345.  * Copyright (c) 1986, 1987, 1989 by William S. Hawes (All Rights Reserved)
  346.  *
  347.  * =====================================================================
  348.  * The header file for the REXX Systems Library
  349. }
  350.  
  351. { Some macro definitions                                               }
  352.  
  353. Const
  354.  
  355.     RXSNAME    : PChar = 'rexxsyslib.library';
  356.     RXSID      : PChar = 'rexxsyslib 1.06 (07 MAR 88)';
  357.     RXSDIR     : PChar = 'REXX';
  358.     RXSTNAME   : PChar = 'ARexx';
  359.  
  360. { The REXX systems library structure.  This should be considered as    }
  361. { semi-private and read-only, except for documented exceptions.        }
  362.  
  363. Type
  364.  
  365.     pRxsLib = ^tRxsLib;
  366.     tRxsLib = record
  367.     rl_Node     : tLibrary;  { EXEC library node             }
  368.     rl_Flags    : Byte;     { global flags                  }
  369.     rl_pad      : Byte;
  370.     rl_SysBase  : Pointer;  { EXEC library base             }
  371.     rl_DOSBase  : Pointer;  { DOS library base              }
  372.     rl_IeeeDPBase   : Pointer;  { IEEE DP math library base     }
  373.     rl_SegList  : Longint;  { library seglist               }
  374.     rl_NIL      : Longint;  { global NIL: filehandle        }
  375.     rl_Chunk    : Longint;  { allocation quantum            }
  376.     rl_MaxNest  : Longint;  { maximum expression nesting    }
  377.     rl_NULL     : pNexxStr;   { static string: NULL           }
  378.     rl_FALSE    : pNexxStr;   { static string: FALSE          }
  379.     rl_TRUE     : pNexxStr;   { static string: TRUE           }
  380.     rl_REXX     : pNexxStr;   { static string: REXX           }
  381.     rl_COMMAND  : pNexxStr;   { static string: COMMAND        }
  382.     rl_STDIN    : pNexxStr;   { static string: STDIN          }
  383.     rl_STDOUT   : pNexxStr;   { static string: STDOUT         }
  384.     rl_STDERR   : pNexxStr;   { static string: STDERR         }
  385.     rl_Version  : STRPTR;   { version/configuration string  }
  386.  
  387.     rl_TaskName : STRPTR;   { name string for tasks         }
  388.     rl_TaskPri  : Longint;  { starting priority             }
  389.     rl_TaskSeg  : Longint;  { startup seglist               }
  390.     rl_StackSize    : Longint;  { stack size                    }
  391.     rl_RexxDir  : STRPTR;   { REXX directory                }
  392.     rl_CTABLE   : STRPTR;   { character attribute table     }
  393.     rl_Notice   : STRPTR;   { copyright notice              }
  394.  
  395.     rl_RexxPort : tMsgPort;  { REXX public port              }
  396.     rl_ReadLock : Word;    { lock count                    }
  397.     rl_TraceFH  : Longint;  { global trace console          }
  398.     rl_TaskList : tList;     { REXX task list                }
  399.     rl_NumTask  : Integer;    { task count                    }
  400.     rl_LibList  : tList;     { Library List header           }
  401.     rl_NumLib   : Integer;    { library count                 }
  402.     rl_ClipList : tList;     { ClipList header               }
  403.     rl_NumClip  : Integer;    { clip node count               }
  404.     rl_MsgList  : tList;     { pending messages              }
  405.     rl_NumMsg   : Integer;    { pending count                 }
  406.     rl_PgmList  : tList;     { cached programs               }
  407.     rl_NumPgm   : Integer;    { program count                 }
  408.  
  409.     rl_TraceCnt : Word;    { usage count for trace console }
  410.     rl_avail    : Integer;
  411.     end;
  412.  
  413. Const
  414.  
  415. { Global flag bit definitions for RexxMaster                           }
  416.     RLFB_TRACE  = RTFB_TRACE;       { interactive tracing?          }
  417.     RLFB_HALT   = RTFB_HALT;        { halt execution?               }
  418.     RLFB_SUSP   = RTFB_SUSP;        { suspend execution?            }
  419.     RLFB_STOP   = 6;            { deny further invocations      }
  420.     RLFB_CLOSE  = 7;            { close the master              }
  421.  
  422.     RLFMASK = 1 + 2 + 4;
  423.  
  424. { Initialization constants                                             }
  425.  
  426.     RXSVERS = 34;           { main version                  }
  427.     RXSREV  = 7;            { revision                      }
  428.     RXSALLOC    = $800000;      { maximum allocation            }
  429.     RXSCHUNK    = 1024;         { allocation quantum            }
  430.     RXSNEST = 32;           { expression nesting limit      }
  431.     RXSTPRI = 0;            { task priority                 }
  432.     RXSSTACK    = 4096;         { stack size                    }
  433.     RXSLISTH    = 5;            { number of list headers        }
  434.  
  435. { Character attribute flag bits used in REXX.                          }
  436.  
  437.     CTB_SPACE   = 0;            { white space characters        }
  438.     CTB_DIGIT   = 1;            { decimal digits 0-9            }
  439.     CTB_ALPHA   = 2;            { alphabetic characters         }
  440.     CTB_REXXSYM = 3;            { REXX symbol characters        }
  441.     CTB_REXXOPR = 4;            { REXX operator characters      }
  442.     CTB_REXXSPC = 5;            { REXX special symbols          }
  443.     CTB_UPPER   = 6;            { UPPERCASE alphabetic          }
  444.     CTB_LOWER   = 7;            { lowercase alphabetic          }
  445.                                                                       
  446. { Attribute flags                                                      }
  447.  
  448.     CTF_SPACE   = 1;
  449.     CTF_DIGIT   = 2;
  450.     CTF_ALPHA   = 4;
  451.     CTF_REXXSYM = 8;
  452.     CTF_REXXOPR = 16;
  453.     CTF_REXXSPC = 32;
  454.     CTF_UPPER   = 64;
  455.     CTF_LOWER   = 128;
  456.  
  457.  
  458. VAR RexxSysBase : pLibrary;
  459.  
  460. PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
  461. FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
  462. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
  463. PROCEDURE DeleteArgstring(argstring : pCHAR);
  464. PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
  465. FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
  466. FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
  467. FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
  468. PROCEDURE LockRexxBase(resource : ULONG);
  469. PROCEDURE UnlockRexxBase(resource : ULONG);
  470.  
  471. IMPLEMENTATION
  472.  
  473. PROCEDURE ClearRexxMsg(msgptr : pRexxMsg; count : ULONG);
  474. BEGIN
  475.   ASM
  476.     MOVE.L  A6,-(A7)
  477.     MOVEA.L msgptr,A0
  478.     MOVE.L  count,D0
  479.     MOVEA.L RexxSysBase,A6
  480.     JSR -156(A6)
  481.     MOVEA.L (A7)+,A6
  482.   END;
  483. END;
  484.  
  485. FUNCTION CreateArgstring(argstring : pCHAR; length : ULONG) : pCHAR;
  486. BEGIN
  487.   ASM
  488.     MOVE.L  A6,-(A7)
  489.     MOVEA.L argstring,A0
  490.     MOVE.L  length,D0
  491.     MOVEA.L RexxSysBase,A6
  492.     JSR -126(A6)
  493.     MOVEA.L (A7)+,A6
  494.     MOVE.L  D0,@RESULT
  495.   END;
  496. END;
  497.  
  498. FUNCTION CreateRexxMsg(port : pMsgPort; extension : pCHAR; host : pCHAR) : pRexxMsg;
  499. BEGIN
  500.   ASM
  501.     MOVE.L  A6,-(A7)
  502.     MOVEA.L port,A0
  503.     MOVEA.L extension,A1
  504.     MOVE.L  host,D0
  505.     MOVEA.L RexxSysBase,A6
  506.     JSR -144(A6)
  507.     MOVEA.L (A7)+,A6
  508.     MOVE.L  D0,@RESULT
  509.   END;
  510. END;
  511.  
  512. PROCEDURE DeleteArgstring(argstring : pCHAR);
  513. BEGIN
  514.   ASM
  515.     MOVE.L  A6,-(A7)
  516.     MOVEA.L argstring,A0
  517.     MOVEA.L RexxSysBase,A6
  518.     JSR -132(A6)
  519.     MOVEA.L (A7)+,A6
  520.   END;
  521. END;
  522.  
  523. PROCEDURE DeleteRexxMsg(packet : pRexxMsg);
  524. BEGIN
  525.   ASM
  526.     MOVE.L  A6,-(A7)
  527.     MOVEA.L packet,A0
  528.     MOVEA.L RexxSysBase,A6
  529.     JSR -150(A6)
  530.     MOVEA.L (A7)+,A6
  531.   END;
  532. END;
  533.  
  534. FUNCTION FillRexxMsg(msgptr : pRexxMsg; count : ULONG; mask : ULONG) : BOOLEAN;
  535. BEGIN
  536.   ASM
  537.     MOVE.L  A6,-(A7)
  538.     MOVEA.L msgptr,A0
  539.     MOVE.L  count,D0
  540.     MOVE.L  mask,D1
  541.     MOVEA.L RexxSysBase,A6
  542.     JSR -162(A6)
  543.     MOVEA.L (A7)+,A6
  544.     TST.W   D0
  545.     BEQ.B   @end
  546.     MOVEQ   #1,D0
  547.   @end: MOVE.B  D0,@RESULT
  548.   END;
  549. END;
  550.  
  551. FUNCTION IsRexxMsg(msgptr : pRexxMsg) : BOOLEAN;
  552. BEGIN
  553.   ASM
  554.     MOVE.L  A6,-(A7)
  555.     MOVEA.L msgptr,A0
  556.     MOVEA.L RexxSysBase,A6
  557.     JSR -168(A6)
  558.     MOVEA.L (A7)+,A6
  559.     TST.W   D0
  560.     BEQ.B   @end
  561.     MOVEQ   #1,D0
  562.   @end: MOVE.B  D0,@RESULT
  563.   END;
  564. END;
  565.  
  566. FUNCTION LengthArgstring(argstring : pCHAR) : ULONG;
  567. BEGIN
  568.   ASM
  569.     MOVE.L  A6,-(A7)
  570.     MOVEA.L argstring,A0
  571.     MOVEA.L RexxSysBase,A6
  572.     JSR -138(A6)
  573.     MOVEA.L (A7)+,A6
  574.     MOVE.L  D0,@RESULT
  575.   END;
  576. END;
  577.  
  578. PROCEDURE LockRexxBase(resource : ULONG);
  579. BEGIN
  580.   ASM
  581.     MOVE.L  A6,-(A7)
  582.     MOVE.L  resource,D0
  583.     MOVEA.L RexxSysBase,A6
  584.     JSR -450(A6)
  585.     MOVEA.L (A7)+,A6
  586.   END;
  587. END;
  588.  
  589. PROCEDURE UnlockRexxBase(resource : ULONG);
  590. BEGIN
  591.   ASM
  592.     MOVE.L  A6,-(A7)
  593.     MOVE.L  resource,D0
  594.     MOVEA.L RexxSysBase,A6
  595.     JSR -456(A6)
  596.     MOVEA.L (A7)+,A6
  597.   END;
  598. END;
  599.  
  600. END. (* UNIT REXXSYSLIB *)
  601.